package io.github.yotta.logger.message.consumer;

import io.github.yotta.logger.message.model.LogOperationDataMessage;
import io.github.yotta.logger.message.support.LogSaveProvider;
import lombok.extern.slf4j.Slf4j;

/**
 * @author yotta
 * @date 2023/3/22 19:34
 */
@Slf4j
public abstract class AbstractLogDataConsumer {

    private final LogSaveProvider logSaveProvider;

    protected AbstractLogDataConsumer(LogSaveProvider logSaveProvider) {
        this.logSaveProvider = logSaveProvider;
    }

    protected void writeToDb(LogOperationDataMessage logMsg) {
        // TODO:
        log.debug("准备写入DB：{}", logMsg);
        logSaveProvider.save(logMsg);
    }

}
